'''
* This is the projet for Brtc LlmOps Platform
* @Author Leon-liao <liaosiliang@alltman.com>
* @Description //TODO 
* @File: app_service.py
* @Time: 2025/11/6
* @All Rights Reserve By Brtc
'''
import uuid
from dataclasses import dataclass
from injector import inject
from internal.model import App

from pkg.sqlalchemy import SQLAlchemy
from .base_service import BaseService

@inject
@dataclass
class AppService(BaseService):
    """数据源"""
    db:SQLAlchemy

    def create_app(self):
        """增加数据"""
        app = self.create(App,
                name = "测试机器人",
                account_id = uuid.uuid4(),
                icon = "<UNK>",
                config = {"description":"<UNK>"},
                description ="康康想要")

        return app


    def get_app(self, uuid:uuid.UUID):
        """查询数据"""
        app = self.get_app(uuid)
        return app


    def update_app(self, uuid:uuid.UUID):
        app = self.get_app(uuid)
        app.name = "康康机器人"
        self.update(app)
        return app


    def delete_app(self, uuid:uuid.UUID):
        app = self.get_app(uuid)
        app = self.delete(app)
        return app